#pragma once

#include "GrandiaX Mana Egg Table Generator Doc.h"


class CGrandiaXManaEggMagicView : public CScrollView
{
public: // create from serialization only
	CGrandiaXManaEggMagicView();
	DECLARE_DYNCREATE(CGrandiaXManaEggMagicView)

// Attributes
public:
	CGrandiaXManaEggTableGeneratorDoc* GetDocument();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CGrandiaXManaEggMagicView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void OnInitialUpdate();
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CGrandiaXManaEggMagicView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

#define TITLENUM 10

    CStatic TitleElement[TITLENUM];
	CStatic TitleSelection[TITLENUM];    
	CStatic TitleTarget[TITLENUM];    
	CStatic TitleArea[TITLENUM];    
	CStatic TitleFunction[TITLENUM];
	CStatic TitleSpecial[TITLENUM];

    CStatic TitleFullMP[TITLENUM];
	CStatic TitleHalfMP[TITLENUM];
	CStatic TitleWidth[TITLENUM];
	CStatic TitleWidthEx[TITLENUM];
	CStatic TitleDuration[TITLENUM];
	CStatic TitleDurationEx[TITLENUM];

    CStatic TitlePower[TITLENUM];
	CStatic TitlePowerEx[TITLENUM];

    CStatic TitleIp[TITLENUM];
	CStatic TitleIpEx[TITLENUM];

    CStatic TitleIpRestore[TITLENUM];
    CStatic TitleCancelIp[TITLENUM];

    CStatic TitleLasting[TITLENUM];
	CStatic TitleLastingEx[TITLENUM];

    CStatic TitleRate[TITLENUM];
    CStatic TitleRateEx[TITLENUM];

	CStatic TitleStatus[TITLENUM][16];
	CStatic TitleStates[TITLENUM][5];

  	CStatic TitleKnockBack[TITLENUM];

    CButton Magics[81];
   	CComboBox Element[81];
   	CComboBox Selection[81];
   	CComboBox Target[81];
   	CComboBox Area[81];
	CComboBox Function[81];
	CComboBox Special[81];

    CEdit FullMP[81];
    CEdit HalfMP[81];
    CEdit Width[81];
    CEdit WidthEx[81];
    CEdit Duration[81];
    CEdit DurationEx[81];

    CEdit Power[81];
    CEdit PowerEx[81];
    
    CEdit Ip[81];
    CEdit IpEx[81];

    CEdit IpRestore[81];
    CEdit CancelIp[81];

    CEdit Lasting[81];
    CEdit LastingEx[81];

    CEdit Rate[81];
    CEdit RateEx[81];

    CButton Status[81][16];
    CButton States[81][5];

    CEdit KnockBack[81];

    void UpdateMagicDescs(int Magic);
    
    void AddTitleTips(HWND hWnd);

// Generated message map functions
protected:

    CToolTipCtrlEx m_tip;

    int IsShiftPressing;
    int IsControlPressing;

    int FocusedEdit;

    void EnsureStateDuration(int Magic, int Time, int TimeEx);
    void EnsureStatusRate(int Magic, int Rate, int RateEx);

    void EnsureWidth(int Magic, int Width, int WidthEx);

    void TitleHelper(int ID);

    virtual BOOL PreTranslateMessage(MSG* pMsg);
    afx_msg void OnReplace();

    DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in GrandiaX Mana Egg Table GeneratorView.cpp
inline CGrandiaXManaEggTableGeneratorDoc* CGrandiaXManaEggMagicView::GetDocument()
   { return (CGrandiaXManaEggTableGeneratorDoc*)m_pDocument; }
#endif